#include <iostream>
using namespace std;
#include <windows.h>

#include "Utils.hpp"

wchar_t* GBKToUnicode(const char* szGBString)
{
        int nLength=MultiByteToWideChar(CP_UTF8,0,szGBString,-1,NULL,0);
        wchar_t* pBuffer = new wchar_t[nLength+1];
        MultiByteToWideChar(CP_UTF8,0,szGBString,-1,pBuffer,nLength);
        pBuffer[nLength]=0;
        return pBuffer;
}

char* UnicodeToGBK(const wchar_t* szUnicodeString)
{
        int nLength=WideCharToMultiByte(CP_UTF8,0,szUnicodeString,-1,NULL,0,NULL,NULL);
        char* pBuffer=new char[nLength+1];
        WideCharToMultiByte(CP_UTF8,0,szUnicodeString,-1,pBuffer,nLength,NULL,NULL);
        pBuffer[nLength]=0;
        return pBuffer;
}

lua_State* Lua_Init(){
	lua_State *L = lua_open();
	luaL_openlibs(L);
	return L;
}
